package cn.itsource.service.impl;

import cn.itsource.domain.Comment;
import cn.itsource.repository.CommentRepository;
import cn.itsource.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

/**
 * 业务实现类：用户Comment
 */
@Service
public class CommentServiceImpl implements CommentService {

    @Autowired
   private CommentRepository commentRepository;


    @Override
    public void add(Comment comment) {
        commentRepository.insert(comment);
    }

    @Override
    public void update(Comment comment) {
        commentRepository.save(comment);
    }

    @Override
    public void delete(String id) {
        commentRepository.deleteById(id);
    }

    @Override
    public List<Comment> findByArticleId(Long articleId) {
        return commentRepository.findByArticleId(articleId);
    }


}
